package com.lu.pojo.oop.commoninterface.comparator;

/**
 * @author luzhenfang
 * @date 2020 05 19
 * @description  学生类
 */
public class StudentImpl implements Comparable<StudentImpl> {
    private String no;
    private String name;
    private int score;
    private int age;

    public StudentImpl(String no, String name, int score, int age) {
        this.no = no;
        this.name = name;
        this.score = score;
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public int compareTo(StudentImpl obj) {
        return this.score>obj.score?1:-1;
    }

    @Override
    public String toString() {
        return "StudentImpl{" +
                "no='" + no + '\'' +
                ", name='" + name + '\'' +
                ", score=" + score +
                ", age=" + age +
                '}'+'\n';
    }
}
